Ngày tải lên :
07/11/2013, 10:15
... to the
text area, we are appending. It is our responsibility to insert the appropriate number of newLine
characters at the appropriate places.
Let's now discuss the call to sort() at listing lines 119 and 188. I needed to pass in the second
and third parameter because I chose to use elements 156 instead of 055. The zero element was
never filled in and I didn't want to have stale garbage influencing the outcome of the sort. I have
already discussed the fact that I implemented Comparable with our object because the compiler
wouldn't let ... the
system is idle to update the display, or finds itself forced to update the display. The lines of code
in updateText() force the display manager to consolidate all of the updates and display them. This
step does slow down processing, so you should do it only at points in time when you feel the user
must see the progress which has been made.
I need to point out one tiny little thing at listing line 103. You may not grasp why I called
trim() after calling get(). The parseInt() static method throws exceptions if the numeric string you
hand it contains spaces. I don't know why it doesn't call trim() on its own, but it doesn't. As you
can see by listing line 111, parseDouble() managed to handle things just fine.
Listing lines 123 through 131 contain something I truly hate about Java 1.4 and earlier. The
NumberFormat object is very primitive. It does provide methods to set the minimum number of
fractional digits, and minimum number of integer digits, but it has no concept of justification, fill
character, or display width. If you try to set both the integer and fraction digits for a column, it
will zero fill on the front and force the display to look something like the following.
... the
system is idle to update the display, or finds itself forced to update the display. The lines of code
in updateText() force the display manager to consolidate all of the updates and display them. This
step does slow down processing, so you should do it only at points in time when you feel the user
must see the progress which has been made.
I need to point out one tiny little thing at listing line 103. You may not grasp why I called
trim() after calling get(). The parseInt() static method throws exceptions if the numeric string you
hand it contains spaces. I don't know why it doesn't call trim() on its own, but it doesn't. As you
can see by listing line 111, parseDouble() managed to handle things just fine.
Listing lines 123 through 131 contain something I truly hate about Java 1.4 and earlier. The
NumberFormat object is very primitive. It does provide methods to set the minimum number of
fractional digits, and minimum number of integer digits, but it has no concept of justification, fill
character, or display width. If you try to set both the integer and fraction digits for a column, it
will zero fill on the front and force the display to look something like the following.
NO...